package aaexcercise.chap5;

/**
 * Created by Administrator on 2017/3/10.
 */
class Tank {
    public static int i = 1;
    boolean isEmpty = false;
    public Tank(boolean isEmpty){
        this.isEmpty = isEmpty;
    }

    public void cleanTank(){
        if (isEmpty == false){
            isEmpty = true;
        }
    }

    @Override
    protected void finalize() throws Throwable {
        //super.finalize();
        if (isEmpty == false){
            System.out.println("Error: tank is not empty"+(i++)
                    +"  "+this.getClass().getName());
        }
    }
int j;//全局可以使用默认
    void f(){
        //局部变量需要手动初始化
//        int i ;
        j++;
    }

}

